package com.bruce.modelscope.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.bruce.modelscope.service.ModelScopeService;

import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import reactor.core.publisher.Flux;

import org.springframework.web.bind.annotation.GetMapping;


@RestController
@RequestMapping("/ai")
@Slf4j
public class AssistantController {

    @Resource
    private ModelScopeService modelScopeService ;


    @GetMapping("/chat")
    public String chat(@RequestParam("message")String question) {
        log.info("question: {}", question);
        return modelScopeService.chat(question);
    }


    /**
     * 获取流式结果
     * @param question
     * @return
     */
    @GetMapping("/chat-stream")
    public Flux<String> chatStream(@RequestParam("message")String question) {
        log.info("question: {}", question);
        return modelScopeService.chatStream(question);
    }

}
